<?php
defined('IN_IXDCW') or exit('Access Denied');
require DT_ROOT.'/module/'.$module.'/common.inc.php';
//最新资讯 news
if($modules == 'news'){
	$tag=Template::tag("moduleid=26&condition=status=3&pagesize=$psize&order=edittime desc&template=null");
	$title = '最新资讯';
	$url = url('info/index');
	$use = 'article';
	$time =1;
	$mod = 'info';
}
//推荐简历 talent
if($modules == 'talent'){
	$GENDER = explode('|', '不限|男士|女士');
	$EDUCATION = explode('|', '不限|初中|高中|大专|本科|硕士|博士');
	$tag=Template::tag("table=resume&condition=status=3 AND level=1&pagesize=$psize&order=edittime desc&template=null");
	$title = '推荐简历';
	$url = url('talent/index');
	$use = 'talent';
	$time =1;
	$mod = 'talent';
}
//推荐职位 job
if($modules == 'com'){
	$tag=Template::tag("table=job&condition=status=3 AND level=1&pagesize=$psize&order=edittime desc&template=null");
	$title = '推荐职位';
	$url = url('job/index');
	$use = 'com';
	$time =1;
	$mod = 'job';
}
//图文资讯 pic
if($modules == 'pic'){
	$tag = Template::tag("moduleid=26&condition=status=3 and level=3 and thumb!=''&pagesize=$psize&order=addtime desc&template=null");
	$title = '图文资讯';
	$url = url('info/index');
	$use = 'article_pic';
	$mod = 'info';

}
//汽车导购 guide
if($modules == 'guide'){
	$tag = Template::tag("moduleid=23&condition=status=3 and thumb!=''&pagesize=$psize&order=addtime desc&template=null");
	$title = '汽车导购';
	$url = url('guide/index');
	$use = 'article_pic';
	$mod = 'guide';
}
//最新合作 coopreation
if($modules == 'cooperation'){
	$tag=Template::tag("moduleid=11&condition=status=3&pagesize=$psize&order=".$city_order."edittime desc&template=null");
	$title = '最新合作';
	$url = url('cooperation/index');
	$use = 'article';
	$mod = 'cooperation';
}
//最新行情 quote
if($modules == 'quote'){
	$tag=Template::tag("moduleid=24&condition=status=3&pagesize=$psize&order=".$city_order."edittime desc&template=null");
	$title = '最新行情';
	$url = url('quote/index');
	$use = 'article';
	$time =1;
	$mod = 'quote';

}
//交通警示 traffic
if($modules == 'traffic'){
	$tag=Template::tag("moduleid=21&condition=status=3&pagesize=$psize&order=edittime desc&template=null");
	$title = '交通警示';
	$url = url('traffic/index');
	$use = 'article';
	$time =1;
	$mod = 'traffic';
}
//学车 learn
if($modules == 'learn'){
	$tag=Template::tag("moduleid=35&condition=status=3&pagesize=$psize&order=rand() desc&template=null",86400);
	$title = '学车';
	$url = url('learn/index');
	$use = 'article';
	$mod = 'learn';
}
//用车 use
if($modules == 'use'){
	$tag=Template::tag("table=manual&condition=status=3&pagesize=$psize&order=rand() desc&template=null");
	$title = '用车';
	$url = url('use/index');
	$use = 'article';
	$mod = 'use';
}
//点击排行 top
if($modules == 'top'){
	$tag=Template::tag("moduleid=26&condition=status=3 and addtime>$today_endtime-31*86400&pagesize=$psize&order=hits desc&template=null",86400);
	if(count($tag)<$psize){
		$num = intval($psize)-count($tag);
		$str = Template::tag("moduleid=26&condition=status=3&pagesize=$num&order=hits desc&template=null",86400);
		$tag = array_merge($tag,$str);
	}
	$title = '点击排行';
	$url = url('info/index');
	$use = 'top';
	$mod = 'info';

}
//新车视频 video
if($modules == 'video'){
	$tag=$db->getAll("select * from {$db->getPre()}video where catid=3274 order by edittime desc limit 6");
	$title = '新车视频';
	$use = 'article_pic';
	$mod = 'video';
}
//最新招商 sell
if($modules == 'sell'){
	$tag=Template::tag("moduleid=5&condition=status=3&pagesize=$psize&order=edittime desc&template=null");
	$title = '最新招商';
	$url = url('sell/index');
	$use = 'article_pic_time';
	$mod = 'sell';
}
//最新采购 purchase
	if($modules == 'purchase'){
		$tag=Template::tag("moduleid=7&condition=status=3&pagesize=$psize&order=edittime desc&template=null");
		$title = '最新采购';
		$url = url('purchase/index');
		$use = 'article_pic_time';
		$mod = 'purchase';
}
//二手信息 buy
if($modules == 'buy'){
	$tag=Template::tag("moduleid=6&condition=status=3&pagesize=$psize&order=edittime desc&template=null");
	$title = '二手信息';
	$url = url('buy/index');
	$use = 'article_pic_time';
	$mod = 'buy';
}
//最新帖子 BBS
if($modules == 'BBS'){
	$use = 'BBS';

}
//汽车批发 sale
if($modules == 'sale'){
	$tag=$db->getAll("select * from {$db->getPre()}auto_sale where status=3 order by addtime desc limit {$psize}");
	$title = '汽车批发';
	$url = url('auto/sale');
	$use = 'sign_up';
}
//汽车车险 insurance
if($modules == 'insurance'){
	$tag=$db->getAll("select * from {$db->getPre()}auto_insurance where 1=1 order by add_time desc limit {$psize}");
	$title = '最低价车险购买';
	$url = url('auto/insurance');
	$use = 'sign_up';
}
//新车关注榜 newhits
if($modules == 'carhits'){
	$tag=$db->getAll("select * from {$db->getPre()}auto_category where level=2 order by hits desc limit {$psize}");
	$title = '新车关注榜';
	$use = 'hits';
}
//新车谍照 new
if($modules == 'new'){
	$tag=$db->getAll("select * from {$db->getPre()}information where status=3 and catid=5153 order by edittime desc limit {$psize}");
	$title = '新车谍照';
	$url = url("buyhelp/newList",'catid=5153');
	$use = 'article';
	$time =1;
	$mod='info';
}
//最新图库 newpic
if($modules == 'newpic'){
	$table = $db->getPre().'auto_picture_'.rand(0,9);
	$tag=$db->getAll("select * from $table where status=1 and title!='' and imgurl!= '' order by rand(),edittime desc limit 30");
	$title = '最新图库';
	$use = 'newpic';
}
//推荐车型 carpic
if($modules == 'carpic'){
	$tag = $db->getAll("
		select a.arid,a.name,a.parentid,r.car_thumb,r.pricerange,r.levelrange
		from {$db->getPre()}auto_category a,{$db->getPre()}auto_rank_car r
        where a.arid=r.arid and a.level=2 and r.car_thumb!=''  order by a.edittime desc limit 6"
	);
	$title = '推荐车型';
	$use = 'carpic';
}
//show页面底部相关推荐 recommend
if($modules == 'recommend'){
	//推荐商家
	$sqlNewBusiness = "
		select * from " . Table::name(Table::NAME_BUSINESS) . "
		where
		mainstore=1 and
		(status=3 or status =2)
	order by itemid DESC limit 4";
	$indexData = $db->getAll($sqlNewBusiness);
	$use = 'recommend';
}
include template('fragment', $module);